import Vue from 'vue'
import Router from 'vue-router'
import admin from '../views/admin'
import user from '../views/user'


Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '*',
      redirect: '/login'
    },
    {
      path: '/login',
      name: 'login',
      component: () => import('@/views/login'),
      meta:{
        // 页面标题title
        title: '登录'
      }
    },
    {
      path:'/admin',
      component:admin,
      redirect:'/admin/wage',
      children:[
        {
          path:"wage",
          component: () => import("@/views/admin/wage"),
          meta:{
            title: '工资管理'
          }
        },
        {
          path:"notice",
          component: () => import("@/views/admin/notice"),
          meta:{
            title: '通知管理'
          }
        },
        {
          path:"user",
          component: () => import("@/views/admin/user"),
          meta:{
            title: '员工管理'
          }
        },
        {
          path:"admin",
          component: () => import("@/views/admin/admin"),
          meta:{
            title: '管理员管理'
          }
        },
        {
          path:"title",
          component: () => import("@/views/admin/title"),
          meta:{
            title: '标题管理'
          }
        }
      ]
    },

    {
      path:'/user',
      component:user,
      redirect:'/user/noticeList',
      children:[
        {
          path:"wage",
          component: () => import("@/views/user/wage"),
          meta:{
            title: '工资查询'
          }
        },
        {
          path:"noticeList",
          component: () => import("@/views/user/noticeList"),
          meta:{
            title: '通知列表'
          }
        },
        {
          path:"msg",
          component: () => import("@/views/user/msg"),
          meta:{
            title: '通知详情'
          }
        },
      ]
    }
  ]
})
